package com.meiqiongproperty.yiguanjia.db.utils;

import android.content.Context;

import com.meiqiongproperty.yiguanjia.db.dao.ShoppingCarDao;
import com.meiqiongproperty.yiguanjia.httpbean.shopcart.ShoppingCarBean;

import java.util.ArrayList;

/**
 * @version V1.0
 * @packge com.meiqiongproperty.yiguanjia.db.utils
 * @User ChenJing
 * @Date 2017/6/18
 */

public class ShopingCartUtils {
    private static ShoppingCarDao mShoppingCart;
    private static ArrayList<ShoppingCarBean> data;
    public static ArrayList<ShoppingCarBean> getAll(Context context){
        mShoppingCart=new ShoppingCarDao(context);
        data=mShoppingCart.queryAll();
        return data;
    }
    public static long setData(ShoppingCarBean data,Context context){
        mShoppingCart=new ShoppingCarDao(context);
        long id=mShoppingCart.add(data);
        return id;
    }
    public static long setAlldata(ArrayList<ShoppingCarBean> data,Context context){
        mShoppingCart=new ShoppingCarDao(context);
        long id=   mShoppingCart.addAll(data);
        return id;
    }

}
